<!--
 * @description: vue3 的 v-model 自定义修饰符 变成大写
 * @Author: lhr
 * @Date: 2020-12-02 20:09:08
 * @LastEditors: lhr
 * @LastEditTime: 2020-12-11 15:28:27
-->
<template>
  <input
    type="text"
    :value="modelValue"
    @input="emitValue($event.target.value)"
  />
</template>
<script>
export default {
  props: {
    modelValue:[String,Number],
    modelModifiers: {
      default: () => ({})
    }
  },
  methods: {
    emitValue(value){
      if(this.modelModifiers.upper){
        value = value.toUpperCase()
      }
      this.$emit('update:modelValue',value)
    }
  },
  created(){
    console.log(this.modelModifiers); // {upper: true}
    this.emitValue(this.modelValue)
  }
};
</script>
